package com.wc.alorithm_blue_bridge._动态规划.背包问题.复杂背包.Q8707_想吃冰淇淋与蛋糕;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/21 10:56
 * @description
 * https://www.lanqiao.cn/problems/8707/learning/?page=1&first_category_id=1
 */
public class Main {
    static int N = (int) 1e5 + 10;
    static int M = 5;
    static int Q = 5;
    // f[i][j][k] 表示第i天吃j类食物第k天最大值
    static int[][][] f = new int[N][M][Q];
    static int n, m, q;
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int[][] a = new int[M][N];

    public static void main(String[] args) {
        n = sc.nextInt();
        m = 2;
        q = 2;
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n; j++) {
                a[i][j] = sc.nextInt();
            }
        }

        // 物品个数
        for (int i = 1; i <= n; i++) {
            // 组别
            for (int j = 1; j <= m; j++) {
                // 限制的天数
                for (int k = 1; k <= q; k++) {
                    // 吃的第一天一定是从别的吃的转移过来的
                    if (k == 1) {
                        int maxHappy = 0;
                        for (int p = 1; p <= m; p++) {
                            if (p == j) {
                                continue;
                            }
                            for (int l = 1; l <= q; l++) {
                                maxHappy = Math.max(maxHappy, f[i - 1][p][l]);
                            }
                        }
                        f[i][j][k] = maxHappy + a[j][i];
                    } else
                        // 吃的第k天使从上一天的第连续k-1天转移过来的
                        f[i][j][k] = f[i - 1][j][k - 1] + a[j][i];
                }
            }
        }
        int maxHappy = 0;
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= q; j++) {
                maxHappy = Math.max(maxHappy, f[n][i][j]);
            }
        }
        out.println(maxHappy);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
